#include "widget.h"
#include "ui_widget.h"
#include<QPainter>
Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);

    QPixmap pixmap(400,300);//指定绘图设备

    QPainter p(&pixmap);

    //填充白色
  //  p.fillRect(0,0,400,300,QBrush(Qt::white));
    pixmap.fill(Qt::white);//利用绘图设备来填充颜色

    p.drawPixmap(0,0,80,80,QPixmap("../Image/face.png"));

    //保存图片
    pixmap.save("../pixmap.png");
}

Widget::~Widget()
{
    delete ui;
}
